import { http } from '@/utils/http'

// 新增
export const appAdd = (data?: object) => {
  return http.request('post', '/app/app', { data })
}

// 编辑
export const costMgtUpdate = (data?: object) => {
  return http.request('post', '/app/update', { data })
}

// 列表
export const getList = (params?: object) => {
  return http.request('get', '/manage/apiLog/apiLogs', { params })
}

// 详情信息
export const getApiDetail = (id: string) => {
  return http.get<{}, HttpResponse<ApiDetail>>(`/manage/apiInfo/${id}/`)
}

// 删除
export const deleteApp = (params?: object) => {
  return http.request('delete', `/app/${params}`)
}

// 部门列表
export const getDeptList = (params?: object) => {
  return http.request('get', '/system/dept/list', { params })
}

export type ApiDetail = {
  id: number
  deptId: number
  apiName: string
  apiType: string
  apiCatalog: string
  apiAuth: string
  encryptionType: string
  apiDesc: string
  apiIntro: string
  requestProtocol: string
  requestMethod: string
  requestPath: string
  serverProdPath: string
  serverTestPath: string
  serverUri: string
  requestTimeOut: number
  serverNetworkType: string
  serverContentType: string
  responseType: string
  responseExampleValue: string
  responseFailValue?: any
  checkStatus: string
  enabledStatus: string
  publishTime?: any
  checkOpinion?: any
  checkBy: string
  checkTime: string
  apiParamList?: any
  apiResponseList?: any
  apiErrorCodeList?: any
  callFreq: number
  apiIconPth: string
  ossId: string
  updateTime: string
  algorithmBasic: string
  version: string
}

export enum ApiCatalogEnum {
  AIGC = 1,
  ObjectDetect = 3,
  /** speech to text */
  STT = 5,
  LLM = 6,
  FaceLibrary = 7,
  FacePicture = 8,
  Mask = 9,
  OcrText = 10,
  OcrLayout = 11,
  IdCard = 12,
  ResidentCard = 13,
  OcrReceipt = 14,
}
